<%
'On Error goto 0
On Error resume next
Response.Addheader "Content-Type","text/html; charset=gb2312" 

set conn = server.CreateObject("ADODB.Connection") '创建连接变量
set rs_bz = server.CreateObject("ADODB.Recordset") '创建连接变量
set rs = server.CreateObject("ADODB.Recordset") '创建连接变量
conn.Open "DRIVER={SQL Server};Server=(local);UID=sa;pwd=123456;DATABASE=HPTsoft" '通过dsn语句打开连接

sqlstr = "SELECT *, CAST(0 AS DECIMAL(10, 2)) AS 早餐补贴金额 ,"
sqlstr = sqlstr & " CAST(0 AS DECIMAL(10, 2)) AS 午餐补贴金额 ,"
sqlstr = sqlstr & " CAST(0 AS DECIMAL(10, 2)) AS 晚餐补贴金额 ,"
sqlstr = sqlstr & " CAST(0 AS DECIMAL(10, 2)) AS 夜宵补贴金额 ,"
sqlstr = sqlstr & " CAST(0 AS DECIMAL(10, 2)) AS 补贴总金额 "
sqlstr = sqlstr & " INTO AAnewTotalLst FROM TotalLst;"
rs.Open sqlstr,conn '复制TotalLst表数据到AAnewTotalLst表


sqlstr = "SELECT Name,早餐补贴金额,午餐补贴金额,晚餐补贴金额,夜宵补贴金额 FROM AA部门补贴标准"
rs_bz.Open sqlstr,conn '查询部门补贴标准

response.write "{""data"":["
do while not rs.eof
	response.write "{"
	response.write """部门名称""" & ":""" & rs("部门名称") & ""","
	response.write """早餐消费次数""" & ":""" & rs("早餐消费次数") & ""","
	response.write """早餐补贴金额""" & ":""" & rs("早餐补贴金额") & ""","
	response.write """午餐消费次数""" & ":""" & rs("午餐消费次数") & ""","
	response.write """午餐补贴金额""" & ":""" & rs("午餐补贴金额") & ""","
	response.write """晚餐消费次数""" & ":""" & rs("晚餐消费次数") & ""","
	response.write """晚餐补贴金额""" & ":""" & rs("晚餐补贴金额") & ""","
	response.write """夜宵消费次数""" & ":""" & rs("夜宵消费次数") & ""","
	response.write """夜宵补贴金额""" & ":""" & rs("夜宵补贴金额") & ""","
	response.write """消费总金额""" & ":""" & rs("消费总金额") & ""","
	response.write """补贴总金额""" & ":""" & rs("补贴总金额") & """}"
	rs.movenext
    If not rs.eof Then
        response.write ","
    End If
loop
response.write "],"
response.write """err"":{""code"":" & Err.Number & ",""Source"":""" & Err.Source & """,""Description"":""" & Err.Description & """}"
response.write "}"
%>